# -*- coding: utf-8 -*-
"""
# @Time    : 2022/11/7 22:00
# @Author  : Youngson
# @File    : Day2
# @Software: PyCharm
# @Desc    : 
"""
import random


def lucky_draw(rewards, employees):
    if isinstance(rewards, list) and isinstance(employees, list):
        employees = set(employees)
        for reward in rewards:
            if not isinstance(reward, dict):
                print("奖项参数错误")
                return

            win = set(random.sample(employees, reward.get("num")))
            employees = employees.difference(win)
            win_str = ', '.join(win)

            print(f'{reward.get("level")}奖品 {reward.get("reward")}\n{reward.get("num")}位获奖者分别是\n{win_str}\n\n')
    else:
        print("参数类型错误")

    return


if __name__ == '__main__':
    name1 = ["赵", "钱", "孙", "李", "周", "吴", "郑", "王"]
    name2 = ["一", "二", "三", "四", "五", "六", "七"]
    employees = [f'{random.choice(name1)}{random.choice(name2)}{random.choice(name2)}' for i in range(300)]

    rewards = [
        {"level": "三等奖", "num": 30, "reward": "运动护具"},
        {"level": "二等奖", "num": 6, "reward": "iPhone"},
        {"level": "一等奖", "num": 3, "reward": "5日游"},
    ]

    lucky_draw(rewards, employees)
